﻿////////////////////////////////////////////////////////////////////////
//Autor: Gabriel Tame Borao  - gabrieltame@yahoo.es 
//Fecha: 2010/09/15 01:26
//Solucion: GTameReport.sln
//Proyecto: GTameReport
//Fichero: ReportParameterType.cs
//
//	Copyright (C) 2010  Gabriel Tame Borao (GTB)
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
namespace GTameReport
{
    using Rdl;
    using System;
    using System.Collections;

    public class ReportParameterType
    {
        private bool? _AllowBlank = null;
        private ReportParameterTypeDataType _DataType;
        private GTameReport.DefaultValueType _DefaultValue;
        private bool? _Hidden = null;
        private bool? _MultiValue = null;
        private bool? _Nullable = null;
        private string _Prompt;
        private ReportParameterTypeUsedInQuery _UsedInQuery;
        private GTameReport.ValidValuesType _ValidValues;
        private string nameField;

        public Rdl.ReportParameterType Write()
        {
            Rdl.ReportParameterType type = new Rdl.ReportParameterType();
            ArrayList list = new ArrayList();
            ArrayList list2 = new ArrayList();
            type.Name = this.nameField;
            if (this._AllowBlank.HasValue)
            {
                list.Add(this._AllowBlank);
                list2.Add(ItemsChoiceType33.AllowBlank);
            }
            list.Add(this._DataType);
            list2.Add(ItemsChoiceType33.DataType);
            if (this._DefaultValue != null)
            {
                list.Add(this._DefaultValue.Write());
                list2.Add(ItemsChoiceType33.DefaultValue);
            }
            if (this._Hidden.HasValue)
            {
                list.Add(this._Hidden);
                list2.Add(ItemsChoiceType33.Hidden);
            }
            if (this._MultiValue.HasValue)
            {
                list.Add(this._MultiValue);
                list2.Add(ItemsChoiceType33.MultiValue);
            }
            if (this._Nullable.HasValue)
            {
                list.Add(this._Nullable);
                list2.Add(ItemsChoiceType33.Nullable);
            }
            if (this._Prompt != null)
            {
                list.Add(this._Prompt);
                list2.Add(ItemsChoiceType33.Prompt);
            }
            list.Add(this._UsedInQuery);
            list2.Add(ItemsChoiceType33.UsedInQuery);
            if (this._ValidValues != null)
            {
                list.Add(this._ValidValues.Write());
                list2.Add(ItemsChoiceType33.ValidValues);
            }
            type.Items = list.ToArray();
            type.ItemsElementName = (ItemsChoiceType33[]) list2.ToArray(typeof(ItemsChoiceType33));
            list2 = null;
            list = null;
            return type;
        }

        public bool? AllowBlank
        {
            get
            {
                return this._AllowBlank;
            }
            set
            {
                this._AllowBlank = value;
            }
        }

        public ReportParameterTypeDataType DataType
        {
            get
            {
                return this._DataType;
            }
            set
            {
                this._DataType = value;
            }
        }

        public GTameReport.DefaultValueType DefaultValue
        {
            get
            {
                if (this._DefaultValue == null)
                {
                    this._DefaultValue = new GTameReport.DefaultValueType();
                }
                return this._DefaultValue;
            }
            set
            {
                this._DefaultValue = value;
            }
        }

        public bool? Hidden
        {
            get
            {
                return this._Hidden;
            }
            set
            {
                this._Hidden = value;
            }
        }

        public bool? MultiValue
        {
            get
            {
                return this._MultiValue;
            }
            set
            {
                this._MultiValue = value;
            }
        }

        public string Name
        {
            get
            {
                return this.nameField;
            }
            set
            {
                this.nameField = value;
            }
        }

        public bool? Nullable
        {
            get
            {
                return this._Nullable;
            }
            set
            {
                this._Nullable = value;
            }
        }

        public string Prompt
        {
            get
            {
                return this._Prompt;
            }
            set
            {
                this._Prompt = value;
            }
        }

        public ReportParameterTypeUsedInQuery UsedInQuery
        {
            get
            {
                return this._UsedInQuery;
            }
            set
            {
                this._UsedInQuery = value;
            }
        }

        public GTameReport.ValidValuesType ValidValues
        {
            get
            {
                if (this._ValidValues == null)
                {
                    this._ValidValues = new GTameReport.ValidValuesType();
                }
                return this._ValidValues;
            }
            set
            {
                this._ValidValues = value;
            }
        }
    }
}

